﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ServiceModel;
using ResourceLoadBalancer.DataAccess;

namespace ResourceLoadBalancer.WebServices.Contracts.Data
{
    [DataContract]
    public class ResourceDataContract
    {
        string hash;
        long sizeInBytes;

        public ResourceDataContract()
        {
            hash = "";
            sizeInBytes = 0;
        }

        [DataMember]
        public string Hash
        {
            get { return hash; }
            set { hash = value; }
        }

        [DataMember]
        public long SizeInBytes
        {
            get { return sizeInBytes; }
            set { sizeInBytes = value; }
        }

        public Resource ConvertDataContractToEntity()
        {
            Resource entity = new Resource();

            entity.Hash = this.Hash;
            entity.SizeInBytes = this.SizeInBytes;

            return entity;
        }
    }
}
